package com.meilai.project.dto.business.contract;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.meilai.project.entity.business.contract.ContractPayDetail;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.validation.annotation.Validated;

import java.math.BigDecimal;
import java.time.LocalDate;

/**
 * @author chenxing
 */
@Data
@ApiModel
@Validated
public class PayDetailReq {
    @ApiModelProperty("付款时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate pay_time;
    @ApiModelProperty("付款金额")
    private BigDecimal pay_amount;
    @ApiModelProperty("付款类型，1现金，2置换")
    private Integer pay_type;

    public ContractPayDetail toPO() {
        ContractPayDetail contractPayDetail = new ContractPayDetail();
        contractPayDetail.setPay_time(this.getPay_time());
        contractPayDetail.setPay_amount(this.getPay_amount());
        contractPayDetail.setPay_type(this.getPay_type());
        return contractPayDetail;
    }
}
